package com.tencent.iov.cowin.befsale.clue.repository.cus.impl;

import com.github.pagehelper.Page;
import com.tencent.iov.cowin.befsale.clue.controller.clue.vo.response.ClueTaskDataHistory;
import com.tencent.iov.cowin.befsale.clue.controller.cus.vo.request.ClueIntentionGradeDataRequest;
import com.tencent.iov.cowin.befsale.clue.dao.cus.DealerCustomerFollowRecordDao;
import com.tencent.iov.cowin.befsale.clue.domain.cus.po.DealerCustomerFollowRecord;
import com.tencent.iov.cowin.befsale.clue.domain.cus.vo.CustomerBehaviorStatistical;
import com.tencent.iov.cowin.befsale.clue.repository.cus.DealerCustomerFollowRecordManager;
import com.tencent.iov.cowin.befsale.clue.value.contants.ServiceConstant;
import com.software.boot.dao.annotation.TargetDataSource;
import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;


/**
 * @Describe: 经销商线索跟进记录_Manager实现层
 * @author: xiamu
 * @created: 2021-12-21 17:29:57
 * @version: 1.0
 */
@Service
public class DealerCustomerFollowRecordManagerImpl implements DealerCustomerFollowRecordManager {

    @Autowired
    private DealerCustomerFollowRecordDao dealerCustomerFollowRecordDao;

    @Override
    @TargetDataSource(ServiceConstant.QW_SALE_READ)
    public DealerCustomerFollowRecord getDetailById(Long id) {
        return dealerCustomerFollowRecordDao.getDetailById(id);
    }

    @Override
    @TargetDataSource(ServiceConstant.QW_SALE_WRITE)
    public int insert(DealerCustomerFollowRecord request) {
        return dealerCustomerFollowRecordDao.insert(request);
    }

    @Override
    @TargetDataSource(ServiceConstant.QW_SALE_WRITE)
    public int insertBatch(List<DealerCustomerFollowRecord> requests) {
        return dealerCustomerFollowRecordDao.insertBatch(requests);
    }

    @Override
    @TargetDataSource(ServiceConstant.QW_SALE_WRITE)
    public int update(DealerCustomerFollowRecord request) {
        return dealerCustomerFollowRecordDao.update(request);
    }

    @Override
    @TargetDataSource(ServiceConstant.QW_SALE_WRITE)
    public int delete(Integer id) {
        return dealerCustomerFollowRecordDao.delete(id);
    }

    @Override
    @TargetDataSource(ServiceConstant.QW_SALE_READ)
    public List<DealerCustomerFollowRecord> getListByParam(DealerCustomerFollowRecord request) {
        return dealerCustomerFollowRecordDao.getListByParam(request);
    }

    @Override
    @TargetDataSource(ServiceConstant.QW_SALE_READ)
    public Page<DealerCustomerFollowRecord> getPageByParam(DealerCustomerFollowRecord request, RowBounds rowBounds) {
        return dealerCustomerFollowRecordDao.getPageByParam(request, rowBounds);
    }

    @Override
    @TargetDataSource(ServiceConstant.QW_SALE_READ)
    public DealerCustomerFollowRecord getOneByParam(DealerCustomerFollowRecord request) {
        return dealerCustomerFollowRecordDao.getOneByParam(request);
    }

    @Override
    @TargetDataSource(ServiceConstant.QW_SALE_READ)
    public List<CustomerBehaviorStatistical> statisticalByStatus(Date startDate, Date endDate, List<Integer> statues) {
        return dealerCustomerFollowRecordDao.statisticalByStatus(startDate, endDate, statues);
    }

    @Override
    @TargetDataSource(ServiceConstant.QW_SALE_READ)
    public List<CustomerBehaviorStatistical> statisticalBySecondStatus(Date startDate, Date endDate, List<Integer> secondStatues) {
        return dealerCustomerFollowRecordDao.statisticalBySecondStatus(startDate, endDate, secondStatues);
    }

    /**
     * 以月份分组，查询月份对应的逾期数量
     * add by zly
     * @param clueIntentionGradeDataRequest
     * @return
     */
    @Override
    public List<ClueTaskDataHistory> getRecordFollowUpHistoryData(ClueIntentionGradeDataRequest clueIntentionGradeDataRequest) {
        return dealerCustomerFollowRecordDao.getRecordFollowUpHistoryData(clueIntentionGradeDataRequest);
    }

    /**
     * 根据状态统计记录表
     * add by zly
     * @param clueIntentionGradeDataRequest
     * @return
     */
    @Override
    public Integer getRecordFollowUpData(ClueIntentionGradeDataRequest clueIntentionGradeDataRequest) {
        return dealerCustomerFollowRecordDao.getRecordFollowUpData(clueIntentionGradeDataRequest);
    }

    @Override
    public void deleteByClueId(Long id) {
        dealerCustomerFollowRecordDao.deleteByClueId(id);
    }
}
